package jerry.cn.rfid_module.Setting.View;

import android.app.Activity;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;

import jerry.cn.rfid_module.R;
import zuo.biao.library.base.BaseView;
import zuo.biao.library.model.Entry;
import zuo.biao.library.util.StringUtil;

public class MainListItemView extends BaseView<Entry<String, String>> implements View.OnClickListener {
    private static final String TAG = "DemoView";

    public MainListItemView(Activity context, ViewGroup parent) {
        super(context, R.layout.mainlist_item, parent);  //TODO demo_view改为你所需要的layout文件
    }


    //示例代码<<<<<<<<<<<<<<<<
    public ImageView ivDemoViewHead;
    public TextView tvDemoViewName;
    //示例代码>>>>>>>>>>>>>>>>
    @Override
    public View createView() {

        //示例代码<<<<<<<<<<<<<<<<
        ivDemoViewHead = findView(R.id.ivDemoViewHead, this);
        tvDemoViewName = findView(R.id.tvDemoViewName);
        //示例代码>>>>>>>>>>>>>>>>

        return super.createView();
    }

    @Override
    public void bindView(Entry<String, String> data_){
        //示例代码<<<<<<<<<<<<<<<<
        super.bindView(data_ != null ? data_ : new Entry<String, String>());
        tvDemoViewName.setText(StringUtil.getTrimedString(data.getKey()));

        ivDemoViewHead.setBackgroundResource(Integer.parseInt(data.getValue()));
        //示例代码>>>>>>>>>>>>>>>>
    }


    //示例代码<<<<<<<<<<<<<<<<
    @Override
    public void onClick(View v) {
        if (data == null) {
            return;
        }
    }
    //示例代码>>>>>>>>>>>>>>>>


}